@import '~styles/vars';

$card-padding: 10px;
$card-height: 250px;
$card-skeleton: linear-gradient($color-white $card-height, transparent 0);
$desc-line-height: 10px;
$desc-line-skeleton: linear-gradient(lightgrey $desc-line-height, transparent 0);
$desc-line-1-width: 90%;
$desc-line-1-position: $card-padding 202px;
$desc-line-2-width: 50%;
$desc-line-2-position: $card-padding 220px;
$blur-width: 220px;
$blur-size: $blur-width $card-height;

.skeleton-frame {
  width: 50%;
  height: $card-height;
  padding: 5px;
  margin-bottom: 10px;
  border-radius: 7px;

  &::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    box-shadow: 0 0 3px $color-grey-shade-4;
    background-image: linear-gradient(
        90deg,
        rgba($color-white, 0) 0,
        rgba($color-white, 0.5) 50%,
        rgba($color-white, 0) 100%
      ),
      $desc-line-skeleton, $desc-line-skeleton, $card-skeleton;
    background-size: $blur-size, $desc-line-1-width $desc-line-height,
      $desc-line-2-width $desc-line-height, 100%, 100% 100%;
    background-position: -200% 0, $desc-line-1-position, $desc-line-2-position, 0 0;
    background-repeat: no-repeat;
    animation: loading 0.8s infinite;
  }
}

@keyframes loading {
  to {
    background-position: 350% 0, $desc-line-1-position, $desc-line-2-position, 0 0;
  }
}
